#!/bin/bash

sum_func ()
{
	if [ $1 -eq $2 ]
	then
		echo $1
	elif [ $1 -lt $2 ];then
		sum=$[$1+$2]
		echo $sum
	else 
		for ((i=$1;i<=$2;i++))
	do
			sum=$[ $sum + $i ]
	done
		for ((i=$2;i<=$1;i++))
	do
			sum=$[ $sum + $i ]
	done
		echo "和为：$sum"
		
	fi
}
echo "请携带年龄参数"
read -p "请输入第一个值：" n1
read -p "请输入第二个值：" n2

sum_func $n1 $n2
